package com.sakura.condition;

import com.sakura.bean.Black;
import com.sakura.bean.Yellow;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author Sakura
 * @Date 2023-02-21 17:33
 */
//自定义逻辑返回需要导入的组件
public class MyImportSelector implements ImportSelector {

    /**
     *
     * @param annotationMetadata 当前标注@Import注解的类的所有注解信息
     * @return 返回值，就是到导入到容器中的组件全类名
     */
    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {
        //方法不要返回null值
        return new String[]{"com.sakura.bean.Black","com.sakura.bean.Yellow"};
    }
}
